﻿namespace MSSqlSchemaDoc.Core.DataStructures
{
    using System;
    using System.Collections.ObjectModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents documentation for a table.
    /// </summary>
    [Serializable()]
    public class TableDocumentation : DocumentationObjectBase
    {
        /// <summary>
        /// Initializes a new instance of the TableDocumentation class.
        /// </summary>
        public TableDocumentation()
        {
            this.Columns = new Collection<ColumnDocumentation>();
            this.Triggers = new Collection<TableTriggerDocumentation>();
            this.Indexes = new Collection<IndexDocumentation>();
            this.ForeignKeys = new Collection<ForeignKeyDocumentation>();
        }

        /// <summary>
        /// Gets the table documentation object type string.
        /// </summary>
        public override DataStructureObjectType ObjectType
        {
            get
            {
                return DataStructureObjectType.TableDocumentation;
            }
        }

        /// <summary>
        /// Gets or sets the column documentation.
        /// </summary>
        [XmlArray()]
        public Collection<ColumnDocumentation> Columns { get; set; }

        /// <summary>
        /// Gets or sets the trigger documentation.
        /// </summary>
        [XmlArray()]
        public Collection<TableTriggerDocumentation> Triggers { get; set; }

        /// <summary>
        /// Gets or sets the documentation for the table indexes.
        /// </summary>
        [XmlArray()]
        public Collection<IndexDocumentation> Indexes { get; set; }

        /// <summary>
        /// Gets or sets the documentation for the foreign key constraints.
        /// </summary>
        [XmlArray()]
        public Collection<ForeignKeyDocumentation> ForeignKeys { get; set; }
    }
}
